using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
    /// <summary> 
    ///Author: nnamthach@gmail.com 
    /// <summary>
    public class InvoiceRegisterInfo
    {
        #region Local Variable
        private Int32 _Reference;
        public Int32 Reference
        {
            get { return _Reference; }
            set { _Reference = value; }
        }
        private String _InvNo;
        public String InvNo
        {
            get { return _InvNo; }
            set { _InvNo = value; }
        }
        private String _Creditor;
        public String Creditor
        {
            get { return _Creditor; }
            set { _Creditor = value; }
        }
        private String _OurRef;
        public String OurRef
        {
            get { return _OurRef; }
            set { _OurRef = value; }
        }
        private DateTime _IssueDate;
        public DateTime IssueDate
        {
            get { return _IssueDate; }
            set { _IssueDate = value; }
        }
        private DateTime _ReceiptDate;
        public DateTime ReceiptDate
        {
            get { return _ReceiptDate; }
            set { _ReceiptDate = value; }
        }
        private Double _Amt;
        public Double Amt
        {
            get { return _Amt; }
            set { _Amt = value; }
        }
        private Double _OtherAmt;
        public Double OtherAmt
        {
            get { return _OtherAmt; }
            set { _OtherAmt = value; }
        }
        private String _Currency;
        public String Currency
        {
            get { return _Currency; }
            set { _Currency = value; }
        }
        private String _PymtRef;
        public String PymtRef
        {
            get { return _PymtRef; }
            set { _PymtRef = value; }
        }
        private DateTime _PaidDate;
        public DateTime PaidDate
        {
            get { return _PaidDate; }
            set { _PaidDate = value; }
        }
        private Int32 _PaymentTerm;
        public Int32 PaymentTerm
        {
            get { return _PaymentTerm; }
            set { _PaymentTerm = value; }
        }
        private DateTime _DueDate;
        public DateTime DueDate
        {
            get { return _DueDate; }
            set { _DueDate = value; }
        }
        private String _Description;
        public String Description
        {
            get { return _Description; }
            set { _Description = value; }
        }
        private String _Contract;
        public String Contract
        {
            get { return _Contract; }
            set { _Contract = value; }
        }
        private DateTime _DeliveryDate;
        public DateTime DeliveryDate
        {
            get { return _DeliveryDate; }
            set { _DeliveryDate = value; }
        }
        private DateTime _ReturnedDate;
        public DateTime ReturnedDate
        {
            get { return _ReturnedDate; }
            set { _ReturnedDate = value; }
        }
        private String _Department;
        public String Department
        {
            get { return _Department; }
            set { _Department = value; }
        }
        private String _Remark1;
        public String Remark1
        {
            get { return _Remark1; }
            set { _Remark1 = value; }
        }
        private String _Remark2;
        public String Remark2
        {
            get { return _Remark2; }
            set { _Remark2 = value; }
        }
        private String _Remark3;
        public String Remark3
        {
            get { return _Remark3; }
            set { _Remark3 = value; }
        }
        private Int32 _Mark;
        public Int32 Mark
        {
            get { return _Mark; }
            set { _Mark = value; }
        }
        private String _TransMitRef;
        public String TransMitRef
        {
            get { return _TransMitRef; }
            set { _TransMitRef = value; }
        }
        private DateTime _TransMitDate;
        public DateTime TransMitDate
        {
            get { return _TransMitDate; }
            set { _TransMitDate = value; }
        }
        private Int32 _MarkTrm;
        public Int32 MarkTrm
        {
            get { return _MarkTrm; }
            set { _MarkTrm = value; }
        }
        private String _TransMitStat;
        public String TransMitStat
        {
            get { return _TransMitStat; }
            set { _TransMitStat = value; }
        }
        private String _Receiver;
        public String Receiver
        {
            get { return _Receiver; }
            set { _Receiver = value; }
        }
        private String _VendorCode;
        public String VendorCode
        {
            get { return _VendorCode; }
            set { _VendorCode = value; }
        }
        private Int16 _LineNo;
        public Int16 LineNo
        {
            get { return _LineNo; }
            set { _LineNo = value; }
        }
        private Double _CvtRate;
        public Double CvtRate
        {
            get { return _CvtRate; }
            set { _CvtRate = value; }
        }
        private String _ReturnRef;
        public String ReturnRef
        {
            get { return _ReturnRef; }
            set { _ReturnRef = value; }
        }
        private String _Budget;
        public String Budget
        {
            get { return _Budget; }
            set { _Budget = value; }
        }
        private Double _VAT;
        public Double VAT
        {
            get { return _VAT; }
            set { _VAT = value; }
        }
        private Double _VATOther;
        public Double VATOther
        {
            get { return _VATOther; }
            set { _VATOther = value; }
        }
        private Double _VATPercent;
        public Double VATPercent
        {
            get { return _VATPercent; }
            set { _VATPercent = value; }
        }
        private String _Originality;
        public String Originality
        {
            get { return _Originality; }
            set { _Originality = value; }
        }
        private Double _CIT;
        public Double CIT
        {
            get { return _CIT; }
            set { _CIT = value; }
        }
        private Double _PayableAmt;
        public Double PayableAmt
        {
            get { return _PayableAmt; }
            set { _PayableAmt = value; }
        }
        private Double _ExpenseAmt;
        public Double ExpenseAmt
        {
            get { return _ExpenseAmt; }
            set { _ExpenseAmt = value; }
        }
        private Int16 _aYear;
        public Int16 aYear
        {
            get { return _aYear; }
            set { _aYear = value; }
        }
        private Double _PayableAmtOther;
        public Double PayableAmtOther
        {
            get { return _PayableAmtOther; }
            set { _PayableAmtOther = value; }
        }
        private String _Business;
        public String Business
        {
            get { return _Business; }
            set { _Business = value; }
        }
        private Int32 _Period;
        public Int32 Period
        {
            get { return _Period; }
            set { _Period = value; }
        }
        private String _Status;
        public String Status
        {
            get { return _Status; }
            set { _Status = value; }
        }
        private String _Voucher;
        public String Voucher
        {
            get { return _Voucher; }
            set { _Voucher = value; }
        }
        private String _ACCNT_CODE;
        public String ACCNT_CODE
        {
            get { return _ACCNT_CODE; }
            set { _ACCNT_CODE = value; }
        }
        private String _InvSN;
        public String InvSN
        {
            get { return _InvSN; }
            set { _InvSN = value; }
        }
        private String _Employee;
        public String Employee
        {
            get { return _Employee; }
            set { _Employee = value; }
        }
        private String _CreatedBy;
        public String CreatedBy
        {
            get { return _CreatedBy; }
            set { _CreatedBy = value; }
        }
        private String _ModifiedBy;
        public String ModifiedBy
        {
            get { return _ModifiedBy; }
            set { _ModifiedBy = value; }
        }
        private DateTime _CreatedDate;
        public DateTime CreatedDate
        {
            get { return _CreatedDate; }
            set { _CreatedDate = value; }
        }
        private DateTime _ModifiedDate;
        public DateTime ModifiedDate
        {
            get { return _ModifiedDate; }
            set { _ModifiedDate = value; }
        }
        #endregion LocalVariable

        #region Constructor
        public InvoiceRegisterInfo()
        {
            _Reference = -1;
            _InvNo = "";
            _Creditor = "";
            _OurRef = "";
            _IssueDate = DateTime.MinValue;
            _ReceiptDate = DateTime.MinValue;
            _Amt = 0;
            _OtherAmt = 0;
            _Currency = "";
            _PymtRef = "";
            _PaidDate = DateTime.MinValue;
            _PaymentTerm = -1;
            _DueDate = DateTime.MinValue;
            _Description = "";
            _Contract = "";
            _DeliveryDate = DateTime.MinValue;
            _ReturnedDate = DateTime.MinValue;
            _Department = "";
            _Remark1 = "";
            _Remark2 = "";
            _Remark3 = "";
            _Mark = -1;
            _TransMitRef = "";
            _TransMitDate = DateTime.MinValue;
            _MarkTrm = -1;
            _TransMitStat = "";
            _Receiver = "";
            _VendorCode = "";
            _LineNo = (Int16)0;
            _CvtRate = 0;
            _ReturnRef = "";
            _Budget = "";
            _VAT = 0;
            _VATOther = 0;
            _VATPercent = 0;
            _Originality = "";
            _CIT = 0;
            _PayableAmt = 0;
            _ExpenseAmt = 0;
            _aYear = (Int16)0;
            _PayableAmtOther = 0;
            _Business = "";
            _Period = -1;
            _Status = "";
            _Voucher = "";
            _ACCNT_CODE = "";
            _InvSN = "";
            _Employee = "";
            _CreatedBy = "";
            _ModifiedBy = "";
            _CreatedDate = DateTime.MinValue;
            _ModifiedDate = DateTime.MinValue;
        }
        public InvoiceRegisterInfo(
            Int32 Reference,
            String InvNo,
            String Creditor,
            String OurRef,
            DateTime IssueDate,
            DateTime ReceiptDate,
            Double Amt,
            Double OtherAmt,
            String Currency,
            String PymtRef,
            DateTime PaidDate,
            Int32 PaymentTerm,
            DateTime DueDate,
            String Description,
            String Contract,
            DateTime DeliveryDate,
            DateTime ReturnedDate,
            String Department,
            String Remark1,
            String Remark2,
            String Remark3,
            Int32 Mark,
            String TransMitRef,
            DateTime TransMitDate,
            Int32 MarkTrm,
            String TransMitStat,
            String Receiver,
            String VendorCode,
            Int16 LineNo,
            Double CvtRate,
            String ReturnRef,
            String Budget,
            Double VAT,
            Double VATOther,
            Double VATPercent,
            String Originality,
            Double CIT,
            Double PayableAmt,
            Double ExpenseAmt,
            Int16 aYear,
            Double PayableAmtOther,
            String Business,
            Int32 Period,
            String Status,
            String Voucher,
            String ACCNT_CODE,
            String InvSN,
            String Employee,
            String CreatedBy,
            String ModifiedBy,
            DateTime CreatedDate,
            DateTime ModifiedDate
            )
        {
            _Reference = Reference;
            _InvNo = InvNo;
            _Creditor = Creditor;
            _OurRef = OurRef;
            _IssueDate = IssueDate;
            _ReceiptDate = ReceiptDate;
            _Amt = Amt;
            _OtherAmt = OtherAmt;
            _Currency = Currency;
            _PymtRef = PymtRef;
            _PaidDate = PaidDate;
            _PaymentTerm = PaymentTerm;
            _DueDate = DueDate;
            _Description = Description;
            _Contract = Contract;
            _DeliveryDate = DeliveryDate;
            _ReturnedDate = ReturnedDate;
            _Department = Department;
            _Remark1 = Remark1;
            _Remark2 = Remark2;
            _Remark3 = Remark3;
            _Mark = Mark;
            _TransMitRef = TransMitRef;
            _TransMitDate = TransMitDate;
            _MarkTrm = MarkTrm;
            _TransMitStat = TransMitStat;
            _Receiver = Receiver;
            _VendorCode = VendorCode;
            _LineNo = LineNo;
            _CvtRate = CvtRate;
            _ReturnRef = ReturnRef;
            _Budget = Budget;
            _VAT = VAT;
            _VATOther = VATOther;
            _VATPercent = VATPercent;
            _Originality = Originality;
            _CIT = CIT;
            _PayableAmt = PayableAmt;
            _ExpenseAmt = ExpenseAmt;
            _aYear = aYear;
            _PayableAmtOther = PayableAmtOther;
            _Business = Business;
            _Period = Period;
            _Status = Status;
            _Voucher = Voucher;
            _ACCNT_CODE = ACCNT_CODE;
            _InvSN = InvSN;
            _Employee = Employee;
            _CreatedBy = CreatedBy;
            _ModifiedBy = ModifiedBy;
            _CreatedDate = CreatedDate;
            _ModifiedDate = ModifiedDate;
        }
        public InvoiceRegisterInfo(InvoiceRegisterInfo obj)
        {
            _Reference = obj.Reference;
            _InvNo = obj.InvNo;
            _Creditor = obj.Creditor;
            _OurRef = obj.OurRef;
            _IssueDate = obj.IssueDate;
            _ReceiptDate = obj.ReceiptDate;
            _Amt = obj.Amt;
            _OtherAmt = obj.OtherAmt;
            _Currency = obj.Currency;
            _PymtRef = obj.PymtRef;
            _PaidDate = obj.PaidDate;
            _PaymentTerm = obj.PaymentTerm;
            _DueDate = obj.DueDate;
            _Description = obj.Description;
            _Contract = obj.Contract;
            _DeliveryDate = obj.DeliveryDate;
            _ReturnedDate = obj.ReturnedDate;
            _Department = obj.Department;
            _Remark1 = obj.Remark1;
            _Remark2 = obj.Remark2;
            _Remark3 = obj.Remark3;
            _Mark = obj.Mark;
            _TransMitRef = obj.TransMitRef;
            _TransMitDate = obj.TransMitDate;
            _MarkTrm = obj.MarkTrm;
            _TransMitStat = obj.TransMitStat;
            _Receiver = obj.Receiver;
            _VendorCode = obj.VendorCode;
            _LineNo = obj.LineNo;
            _CvtRate = obj.CvtRate;
            _ReturnRef = obj.ReturnRef;
            _Budget = obj.Budget;
            _VAT = obj.VAT;
            _VATOther = obj.VATOther;
            _VATPercent = obj.VATPercent;
            _Originality = obj.Originality;
            _CIT = obj.CIT;
            _PayableAmt = obj.PayableAmt;
            _ExpenseAmt = obj.ExpenseAmt;
            _aYear = obj.aYear;
            _PayableAmtOther = obj.PayableAmtOther;
            _Business = obj.Business;
            _Period = obj.Period;
            _Status = obj.Status;
            _Voucher = obj.Voucher;
            _ACCNT_CODE = obj.ACCNT_CODE;
            _InvSN = obj.InvSN;
            _Employee = obj.Employee;
            _CreatedBy = obj.CreatedBy;
            _ModifiedBy = obj.ModifiedBy;
            _CreatedDate = obj.CreatedDate;
            _ModifiedDate = obj.ModifiedDate;
        }
        public InvoiceRegisterInfo(DataRow dr)
        {
            if (dr != null)
            {
                _Reference = dr["Reference"] == DBNull.Value ? -1 : (Int32)dr["Reference"];
                _InvNo = dr["InvNo"] == DBNull.Value ? "" : (String)dr["InvNo"];
                _Creditor = dr["Creditor"] == DBNull.Value ? "" : (String)dr["Creditor"];
                _OurRef = dr["OurRef"] == DBNull.Value ? "" : (String)dr["OurRef"];
                _IssueDate = dr["IssueDate"] == DBNull.Value ? DateTime.MinValue : (DateTime)dr["IssueDate"];
                _ReceiptDate = dr["ReceiptDate"] == DBNull.Value ? DateTime.MinValue : (DateTime)dr["ReceiptDate"];
                _Amt = dr["Amt"] == DBNull.Value ? 0 : (Double)dr["Amt"];
                _OtherAmt = dr["OtherAmt"] == DBNull.Value ? 0 : (Double)dr["OtherAmt"];
                _Currency = dr["Currency"] == DBNull.Value ? "" : (String)dr["Currency"];
                _PymtRef = dr["PymtRef"] == DBNull.Value ? "" : (String)dr["PymtRef"];
                _PaidDate = dr["PaidDate"] == DBNull.Value ? DateTime.MinValue : (DateTime)dr["PaidDate"];
                _PaymentTerm = dr["PaymentTerm"] == DBNull.Value ? -1 : (Int32)dr["PaymentTerm"];
                _DueDate = dr["DueDate"] == DBNull.Value ? DateTime.MinValue : (DateTime)dr["DueDate"];
                _Description = dr["Description"] == DBNull.Value ? "" : (String)dr["Description"];
                _Contract = dr["Contract"] == DBNull.Value ? "" : (String)dr["Contract"];
                _DeliveryDate = dr["DeliveryDate"] == DBNull.Value ? DateTime.MinValue : (DateTime)dr["DeliveryDate"];
                _ReturnedDate = dr["ReturnedDate"] == DBNull.Value ? DateTime.MinValue : (DateTime)dr["ReturnedDate"];
                _Department = dr["Department"] == DBNull.Value ? "" : (String)dr["Department"];
                _Remark1 = dr["Remark1"] == DBNull.Value ? "" : (String)dr["Remark1"];
                _Remark2 = dr["Remark2"] == DBNull.Value ? "" : (String)dr["Remark2"];
                _Remark3 = dr["Remark3"] == DBNull.Value ? "" : (String)dr["Remark3"];
                _Mark = dr["Mark"] == DBNull.Value ? -1 : (Int32)dr["Mark"];
                _TransMitRef = dr["TransMitRef"] == DBNull.Value ? "" : (String)dr["TransMitRef"];
                _TransMitDate = dr["TransMitDate"] == DBNull.Value ? DateTime.MinValue : (DateTime)dr["TransMitDate"];
                _MarkTrm = dr["MarkTrm"] == DBNull.Value ? -1 : (Int32)dr["MarkTrm"];
                _TransMitStat = dr["TransMitStat"] == DBNull.Value ? "" : (String)dr["TransMitStat"];
                _Receiver = dr["Receiver"] == DBNull.Value ? "" : (String)dr["Receiver"];
                _VendorCode = dr["VendorCode"] == DBNull.Value ? "" : (String)dr["VendorCode"];
                _LineNo = dr["LineNo"] == DBNull.Value ? (Int16)0 : (Int16)dr["LineNo"];
                _CvtRate = dr["CvtRate"] == DBNull.Value ? 0 : double.Parse(dr["CvtRate"].ToString());
                _ReturnRef = dr["ReturnRef"] == DBNull.Value ? "" : (String)dr["ReturnRef"];
                _Budget = dr["Budget"] == DBNull.Value ? "" : (String)dr["Budget"];
                _VAT = dr["VAT"] == DBNull.Value ? 0 : (Double)dr["VAT"];
                _VATOther = dr["VATOther"] == DBNull.Value ? 0 : (Double)dr["VATOther"];
                _VATPercent = dr["VATPercent"] == DBNull.Value ? 0 : (Double)dr["VATPercent"];
                _Originality = dr["Originality"] == DBNull.Value ? "" : (String)dr["Originality"];
                _CIT = dr["CIT"] == DBNull.Value ? 0 : (Double)dr["CIT"];
                _PayableAmt = dr["PayableAmt"] == DBNull.Value ? 0 : (Double)dr["PayableAmt"];
                _ExpenseAmt = dr["ExpenseAmt"] == DBNull.Value ? 0 : (Double)dr["ExpenseAmt"];
                _aYear = dr["aYear"] == DBNull.Value ? (Int16)0 : (Int16)dr["aYear"];
                _PayableAmtOther = dr["PayableAmtOther"] == DBNull.Value ? 0 : (Double)dr["PayableAmtOther"];
                _Business = dr["Business"] == DBNull.Value ? "" : (String)dr["Business"];
                _Period = dr["Period"] == DBNull.Value ? -1 : (Int32)dr["Period"];
                _Status = dr["Status"] == DBNull.Value ? "" : (String)dr["Status"];
                _Voucher = dr["Voucher"] == DBNull.Value ? "" : (String)dr["Voucher"];
                _ACCNT_CODE = dr["ACCNT_CODE"] == DBNull.Value ? "" : (String)dr["ACCNT_CODE"];
                _InvSN = dr["InvSN"] == DBNull.Value ? "" : (String)dr["InvSN"];
                _Employee = dr["Employee"] == DBNull.Value ? "" : (String)dr["Employee"];
                _CreatedBy = dr["CreatedBy"] == DBNull.Value ? "" : (String)dr["CreatedBy"];
                _ModifiedBy = dr["ModifiedBy"] == DBNull.Value ? "" : (String)dr["ModifiedBy"];
                _CreatedDate = dr["CreatedDate"] == DBNull.Value ? DateTime.MinValue : (DateTime)dr["CreatedDate"];
                _ModifiedDate = dr["ModifiedDate"] == DBNull.Value ? DateTime.MinValue : (DateTime)dr["ModifiedDate"];
            }
        }
        public InvoiceRegisterInfo(DataRowView dr)
        {
            if (dr != null)
            {
                _Reference = dr["Reference"] == DBNull.Value ? -1 : (Int32)dr["Reference"];
                _InvNo = dr["InvNo"] == DBNull.Value ? "" : (String)dr["InvNo"];
                _Creditor = dr["Creditor"] == DBNull.Value ? "" : (String)dr["Creditor"];
                _OurRef = dr["OurRef"] == DBNull.Value ? "" : (String)dr["OurRef"];
                _IssueDate = dr["IssueDate"] == DBNull.Value ? DateTime.MinValue : (DateTime)dr["IssueDate"];
                _ReceiptDate = dr["ReceiptDate"] == DBNull.Value ? DateTime.MinValue : (DateTime)dr["ReceiptDate"];
                _Amt = dr["Amt"] == DBNull.Value ? 0 : (Double)dr["Amt"];
                _OtherAmt = dr["OtherAmt"] == DBNull.Value ? 0 : (Double)dr["OtherAmt"];
                _Currency = dr["Currency"] == DBNull.Value ? "" : (String)dr["Currency"];
                _PymtRef = dr["PymtRef"] == DBNull.Value ? "" : (String)dr["PymtRef"];
                _PaidDate = dr["PaidDate"] == DBNull.Value ? DateTime.MinValue : (DateTime)dr["PaidDate"];
                _PaymentTerm = dr["PaymentTerm"] == DBNull.Value ? -1 : (Int32)dr["PaymentTerm"];
                _DueDate = dr["DueDate"] == DBNull.Value ? DateTime.MinValue : (DateTime)dr["DueDate"];
                _Description = dr["Description"] == DBNull.Value ? "" : (String)dr["Description"];
                _Contract = dr["Contract"] == DBNull.Value ? "" : (String)dr["Contract"];
                _DeliveryDate = dr["DeliveryDate"] == DBNull.Value ? DateTime.MinValue : (DateTime)dr["DeliveryDate"];
                _ReturnedDate = dr["ReturnedDate"] == DBNull.Value ? DateTime.MinValue : (DateTime)dr["ReturnedDate"];
                _Department = dr["Department"] == DBNull.Value ? "" : (String)dr["Department"];
                _Remark1 = dr["Remark1"] == DBNull.Value ? "" : (String)dr["Remark1"];
                _Remark2 = dr["Remark2"] == DBNull.Value ? "" : (String)dr["Remark2"];
                _Remark3 = dr["Remark3"] == DBNull.Value ? "" : (String)dr["Remark3"];
                _Mark = dr["Mark"] == DBNull.Value ? -1 : (Int32)dr["Mark"];
                _TransMitRef = dr["TransMitRef"] == DBNull.Value ? "" : (String)dr["TransMitRef"];
                _TransMitDate = dr["TransMitDate"] == DBNull.Value ? DateTime.MinValue : (DateTime)dr["TransMitDate"];
                _MarkTrm = dr["MarkTrm"] == DBNull.Value ? -1 : (Int32)dr["MarkTrm"];
                _TransMitStat = dr["TransMitStat"] == DBNull.Value ? "" : (String)dr["TransMitStat"];
                _Receiver = dr["Receiver"] == DBNull.Value ? "" : (String)dr["Receiver"];
                _VendorCode = dr["VendorCode"] == DBNull.Value ? "" : (String)dr["VendorCode"];
                _LineNo = dr["LineNo"] == DBNull.Value ? (Int16)0 : (Int16)dr["LineNo"];

                _CvtRate = dr["CvtRate"] == DBNull.Value ? 0 : double.Parse(dr["CvtRate"].ToString());
                _ReturnRef = dr["ReturnRef"] == DBNull.Value ? "" : (String)dr["ReturnRef"];
                _Budget = dr["Budget"] == DBNull.Value ? "" : (String)dr["Budget"];
                _VAT = dr["VAT"] == DBNull.Value ? 0 : (Double)dr["VAT"];
                _VATOther = dr["VATOther"] == DBNull.Value ? 0 : (Double)dr["VATOther"];
                _VATPercent = dr["VATPercent"] == DBNull.Value ? 0 : (Double)dr["VATPercent"];
                _Originality = dr["Originality"] == DBNull.Value ? "" : (String)dr["Originality"];
                _CIT = dr["CIT"] == DBNull.Value ? 0 : (Double)dr["CIT"];
                _PayableAmt = dr["PayableAmt"] == DBNull.Value ? 0 : (Double)dr["PayableAmt"];
                _ExpenseAmt = dr["ExpenseAmt"] == DBNull.Value ? 0 : (Double)dr["ExpenseAmt"];
                _aYear = dr["aYear"] == DBNull.Value ? (Int16)0 : (Int16)dr["aYear"];
                _PayableAmtOther = dr["PayableAmtOther"] == DBNull.Value ? 0 : (Double)dr["PayableAmtOther"];
                _Business = dr["Business"] == DBNull.Value ? "" : (String)dr["Business"];
                _Period = dr["Period"] == DBNull.Value ? -1 : (Int32)dr["Period"];
                _Status = dr["Status"] == DBNull.Value ? "" : (String)dr["Status"];
                _Voucher = dr["Voucher"] == DBNull.Value ? "" : (String)dr["Voucher"];
                _ACCNT_CODE = dr["ACCNT_CODE"] == DBNull.Value ? "" : (String)dr["ACCNT_CODE"];
                _InvSN = dr["InvSN"] == DBNull.Value ? "" : (String)dr["InvSN"];
                _Employee = dr["Employee"] == DBNull.Value ? "" : (String)dr["Employee"];
                _CreatedBy = dr["CreatedBy"] == DBNull.Value ? "" : (String)dr["CreatedBy"];
                _ModifiedBy = dr["ModifiedBy"] == DBNull.Value ? "" : (String)dr["ModifiedBy"];
                _CreatedDate = dr["CreatedDate"] == DBNull.Value ? DateTime.MinValue : (DateTime)dr["CreatedDate"];
                _ModifiedDate = dr["ModifiedDate"] == DBNull.Value ? DateTime.MinValue : (DateTime)dr["ModifiedDate"];
            }
        }
        #endregion Constructor

        #region InitTable
        public DataTable ToDataTable()
        {
            DataTable dt = new DataTable("TblInvoiceRegister");
            dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn("Reference", typeof(Int32)),
				new DataColumn("InvNo", typeof(String)),
				new DataColumn("Creditor", typeof(String)),
				new DataColumn("OurRef", typeof(String)),
				new DataColumn("IssueDate", typeof(DateTime)),
				new DataColumn("ReceiptDate", typeof(DateTime)),
				new DataColumn("Amt", typeof(Double)),
				new DataColumn("OtherAmt", typeof(Double)),
				new DataColumn("Currency", typeof(String)),
				new DataColumn("PymtRef", typeof(String)),
				new DataColumn("PaidDate", typeof(DateTime)),
				new DataColumn("PaymentTerm", typeof(Int32)),
				new DataColumn("DueDate", typeof(DateTime)),
				new DataColumn("Description", typeof(String)),
				new DataColumn("Contract", typeof(String)),
				new DataColumn("DeliveryDate", typeof(DateTime)),
				new DataColumn("ReturnedDate", typeof(DateTime)),
				new DataColumn("Department", typeof(String)),
				new DataColumn("Remark1", typeof(String)),
				new DataColumn("Remark2", typeof(String)),
				new DataColumn("Remark3", typeof(String)),
				new DataColumn("Mark", typeof(Int32)),
				new DataColumn("TransMitRef", typeof(String)),
				new DataColumn("TransMitDate", typeof(DateTime)),
				new DataColumn("MarkTrm", typeof(Int32)),
				new DataColumn("TransMitStat", typeof(String)),
				new DataColumn("Receiver", typeof(String)),
				new DataColumn("VendorCode", typeof(String)),
				new DataColumn("LineNo", typeof(Int16)),
				new DataColumn("CvtRate", typeof(Double)),
				new DataColumn("ReturnRef", typeof(String)),
				new DataColumn("Budget", typeof(String)),
				new DataColumn("VAT", typeof(Double)),
				new DataColumn("VATOther", typeof(Double)),
				new DataColumn("VATPercent", typeof(Double)),
				new DataColumn("Originality", typeof(String)),
				new DataColumn("CIT", typeof(Double)),
				new DataColumn("PayableAmt", typeof(Double)),
				new DataColumn("ExpenseAmt", typeof(Double)),
				new DataColumn("aYear", typeof(Int16)),
				new DataColumn("PayableAmtOther", typeof(Double)),
				new DataColumn("Business", typeof(String)),
				new DataColumn("Period", typeof(Int32)),
				new DataColumn("Status", typeof(String)),
				new DataColumn("Voucher", typeof(String)),
				new DataColumn("ACCNT_CODE", typeof(String)),
				new DataColumn("InvSN", typeof(String)),
				new DataColumn("Employee", typeof(String)),
				new DataColumn("CreatedBy", typeof(String)),
				new DataColumn("ModifiedBy", typeof(String)),
				new DataColumn("CreatedDate", typeof(DateTime)),
				new DataColumn("ModifiedDate", typeof(DateTime))
				});
            return dt;
        }
        public DataRow ToDataRow(DataTable dt)
        {
            DataRow row = dt.NewRow();
            row["Reference"] = _Reference;
            row["InvNo"] = _InvNo;
            row["Creditor"] = _Creditor;
            row["OurRef"] = _OurRef;
            row["IssueDate"] = _IssueDate;
            row["ReceiptDate"] = _ReceiptDate;
            row["Amt"] = _Amt;
            row["OtherAmt"] = _OtherAmt;
            row["Currency"] = _Currency;
            row["PymtRef"] = _PymtRef;
            row["PaidDate"] = _PaidDate;
            row["PaymentTerm"] = _PaymentTerm;
            row["DueDate"] = _DueDate;
            row["Description"] = _Description;
            row["Contract"] = _Contract;
            row["DeliveryDate"] = _DeliveryDate;
            row["ReturnedDate"] = _ReturnedDate;
            row["Department"] = _Department;
            row["Remark1"] = _Remark1;
            row["Remark2"] = _Remark2;
            row["Remark3"] = _Remark3;
            row["Mark"] = _Mark;
            row["TransMitRef"] = _TransMitRef;
            row["TransMitDate"] = _TransMitDate;
            row["MarkTrm"] = _MarkTrm;
            row["TransMitStat"] = _TransMitStat;
            row["Receiver"] = _Receiver;
            row["VendorCode"] = _VendorCode;
            row["LineNo"] = _LineNo;
            row["CvtRate"] = _CvtRate;
            row["ReturnRef"] = _ReturnRef;
            row["Budget"] = _Budget;
            row["VAT"] = _VAT;
            row["VATOther"] = _VATOther;
            row["VATPercent"] = _VATPercent;
            row["Originality"] = _Originality;
            row["CIT"] = _CIT;
            row["PayableAmt"] = _PayableAmt;
            row["ExpenseAmt"] = _ExpenseAmt;
            row["aYear"] = _aYear;
            row["PayableAmtOther"] = _PayableAmtOther;
            row["Business"] = _Business;
            row["Period"] = _Period;
            row["Status"] = _Status;
            row["Voucher"] = _Voucher;
            row["ACCNT_CODE"] = _ACCNT_CODE;
            row["InvSN"] = _InvSN;
            row["Employee"] = _Employee;
            row["CreatedBy"] = _CreatedBy;
            row["ModifiedBy"] = _ModifiedBy;
            row["CreatedDate"] = _CreatedDate;
            row["ModifiedDate"] = _ModifiedDate;
            return row;
        }
        #endregion InitTable
    }
}
